HAL SMBUS io operation functions migration

This section provides information about the HAL SMBUS io operation functions migration.

Important

The main difference between HAL1 and HAL2 in all transmit and receive functions in interrupt mode is the way buffer size is specified. HAL1 uses Size for the number of data elements (u16), while HAL2 uses Size_byte to specify the buffer size in bytes, allowing more precise control.

HAL SMBUS master receives data with interrupt

HAL1

HAL2

HAL_SMBUS_Master_Transmit_IT(SMBUS_HandleTypeDef *hsmbus, uint16_t DevAddress,
                                      uint8_t *pData, uint16_t Size, uint32_t XferOptions);
HAL_SMBUS_Master_Receive_IT(SMBUS_HandleTypeDef *hsmbus, uint16_t DevAddress,
                                     uint8_t *pData, uint16_t Size, uint32_t XferOptions);
HAL_SMBUS_MASTER_SEQ_Transmit_IT(hal_smbus_handle_t *hsmbus, uint32_t device_addr, const void *p_data,
                                     uint32_t size_byte, hal_smbus_xfer_opt_t xfer_opt);
HAL_SMBUS_MASTER_SEQ_Receive_IT(hal_smbus_handle_t *hsmbus, uint32_t device_addr, void *p_data,
                                    uint32_t size_byte, hal_smbus_xfer_opt_t xfer_opt);

Related use cases: Use case: SMBUS master transmit in interrupt mode


HAL SMBUS slave receives data with interrupt

HAL1

HAL2

HAL_SMBUS_Slave_Transmit_IT(SMBUS_HandleTypeDef *hsmbus, uint8_t *pData, uint16_t Size,
                                     uint32_t XferOptions);
HAL_SMBUS_Slave_Receive_IT(SMBUS_HandleTypeDef *hsmbus, uint8_t *pData, uint16_t Size,
                                    uint32_t XferOptions);
HAL_SMBUS_SLAVE_SEQ_Transmit_IT(hal_smbus_handle_t *hsmbus, const void *p_data, uint32_t size_byte,
                                    hal_smbus_xfer_opt_t xfer_opt);
HAL_SMBUS_SLAVE_SEQ_Receive_IT(hal_smbus_handle_t *hsmbus, void *p_data, uint32_t size_byte,
                                   hal_smbus_xfer_opt_t xfer_opt);

Related use cases: Use case: SMBUS slave receive in interrupt mode


HAL SMBUS slave listen interrupt

HAL1

HAL2

HAL_SMBUS_EnableListen_IT(SMBUS_HandleTypeDef *hsmbus);
HAL_SMBUS_DisableListen_IT(SMBUS_HandleTypeDef *hsmbus);
HAL_SMBUS_SLAVE_EnableListen_IT(hal_smbus_handle_t *hsmbus);
HAL_SMBUS_SLAVE_DisableListen_IT(hal_smbus_handle_t *hsmbus);

Related use cases: Use case: SMBUS slave receive in interrupt mode


HAL SMBUS alert interrupt

HAL1

HAL2

HAL_SMBUS_EnableAlert_IT(SMBUS_HandleTypeDef *hsmbus);
HAL_SMBUS_DisableAlert_IT(SMBUS_HandleTypeDef *hsmbus);
HAL_SMBUS_MASTER_EnableAlertIT(hal_smbus_handle_t *hsmbus);
HAL_SMBUS_MASTER_DisableAlertIT(hal_smbus_handle_t *hsmbus);
HAL_SMBUS_MASTER_IsEnabledAlertIT(const hal_smbus_handle_t *hsmbus);

HAL SMBUS check device ready

HAL1

HAL2

HAL_SMBUS_IsDeviceReady(SMBUS_HandleTypeDef *hsmbus, uint16_t DevAddress, uint32_t Trials, uint32_t Timeout);
HAL_SMBUS_MASTER_PollForSlaveReady(hal_smbus_handle_t *hsmbus, uint32_t device_addr, uint32_t timeout_ms);

HAL SMBUS master abort transfer with interrupt

HAL1

HAL2

HAL_SMBUS_Master_Abort_IT(SMBUS_HandleTypeDef *hsmbus, uint16_t DevAddress);
HAL_SMBUS_MASTER_Abort_IT(hal_smbus_handle_t *hsmbus, uint32_t device_addr);

HAL SMBUS fast mode plus configuration

HAL1

HAL2

HAL_SMBUSEx_ConfigFastModePlus(SMBUS_HandleTypeDef *hsmbus, uint32_t FastModePlus);
Removed.
Split the function HAL_SMBUSEx_ConfigFastModePlus in unitary APIs to enable and disable the fast mode plus
and the configuration of pin managed by SYSCFG driver ``HAL_SYSCFG_EnableI2CFastModePlus`` and ``HAL_SYSCFG_DisableI2CFastModePlus`` ,
or by HAL SBS driver ``HAL_SBS_EnableFastModePlus()`` , ``HAL_SBS_DisableFastModePlus()``.

Related concept : Unitary configuration APIs


HAL SMBUS fast mode plus

HAL1

HAL2

HAL_SMBUSEx_EnableFastModePlus(uint32_t ConfigFastModePlus);
HAL_SMBUSEx_DisableFastModePlus(uint32_t ConfigFastModePlus);
HAL_SMBUS_EnableFastModePlus(hal_smbus_handle_t *hsmbus);
HAL_SMBUS_DisableFastModePlus(hal_smbus_handle_t *hsmbus);
HAL_SMBUS_IsEnabledFastModePlus(const hal_smbus_handle_t *hsmbus);

HAL SMBUS wake-up feature

HAL1

HAL2

HAL_SMBUSEx_EnableWakeUp(SMBUS_HandleTypeDef *hsmbus);
HAL_SMBUSEx_DisableWakeUp(SMBUS_HandleTypeDef *hsmbus);
HAL_SMBUS_SLAVE_EnableWakeUp(hal_smbus_handle_t *hsmbus);
HAL_SMBUS_SLAVE_DisableWakeUp(hal_smbus_handle_t *hsmbus);

HAL SMBUS autonomous mode configuration

HAL1

HAL2

HAL_SMBUSEx_SetConfigAutonomousMode(SMBUS_HandleTypeDef *hsmbus,
                                             const SMBUS_AutonomousModeConfTypeDef *sConfig);
HAL_SMBUS_AM_SetConfigTrigger(hal_smbus_handle_t *hsmbus,
                                  const hal_smbus_am_trig_config_t *p_config);
HAL_SMBUS_AM_EnableTrigger(hal_smbus_handle_t *hsmbus);
HAL_SMBUS_AM_IsEnabledTrigger(const hal_smbus_handle_t *hsmbus);
  • Optionally To get the configuration of SMBUS autonomous mode and disable it, use the functions HAL_SMBUS_AM_GetConfigTrigger() and HAL_SMBUS_AM_DisableTrigger().

HAL1

HAL2

HAL_SMBUSEx_GetConfigAutonomousMode(const SMBUS_HandleTypeDef *hsmbus,
                                             SMBUS_AutonomousModeConfTypeDef *sConfig);
HAL_SMBUSEx_ClearConfigAutonomousMode(SMBUS_HandleTypeDef *hsmbus);
HAL_SMBUS_AM_GetConfigTrigger(const hal_smbus_handle_t *hsmbus,
                                             hal_smbus_am_trig_config_t *p_config);
HAL_SMBUS_AM_DisableTrigger(hal_smbus_handle_t *hsmbus);

HAL SMBUS analog filter configuration

HAL1

HAL2

HAL_SMBUS_ConfigAnalogFilter(SMBUS_HandleTypeDef *hsmbus, uint32_t AnalogFilter);
HAL_SMBUS_EnableAnalogFilter(hal_smbus_handle_t *hsmbus);
HAL_SMBUS_DisableAnalogFilter(hal_smbus_handle_t *hsmbus);
HAL_SMBUS_IsEnabledAnalogFilter(const hal_smbus_handle_t *hsmbus);

Configure SMBUS digital filter

HAL1

HAL2

HAL_SMBUS_ConfigDigitalFilter(SMBUS_HandleTypeDef *hsmbus, uint32_t DigitalFilter);
HAL_SMBUS_SetDigitalFilter(hal_smbus_handle_t *hsmbus, uint32_t noise_filtering_in_bus_clk_period);